<template>
  <div>
    <a-card class="info" title="笔记本采购申请">
      <template slot="extra">
        <!-- <template v-if="model.auditStatus==0">

          </template>
          <template v-if="model.auditStatus==1">
            <a-button type="primary" size="small" @click="handleAudit(model.id)"  :disabled="isDisabledAuth('erpComputerPurchase:audit')">审核</a-button>
          </template>
          <template v-if="model.auditStatus==2">
            <a-popconfirm title="确定反审吗?" @confirm="() => handleCounterTrial(model.id)">
              <a-button type="primary" size="small" :disabled="isDisabledAuth('erpComputerPurchase:counterTrial')">反审</a-button>
            </a-popconfirm>
          </template>
        </template>
      <a-row type="flex"  justify="center">
        <a-col :span="24">
            <erp-computer-purchase-form ref="realForm" :disabled="true" normal></erp-computer-purchase-form>
        </a-col>
      </a-row>
      <erp-computer-purchase-modal ref="modalForm" @ok="modalFormOk"></erp-computer-purchase-modal>
      <audit-modal ref="auditModal" @ok="modalFormOk"></audit-modal> -->
      </template>
      <!-- <biz-his-task-module ref="bizHisTask" :formData="formData"> -->
      <a-row type="flex" justify="center">
        <a-col :span="24" >
          <erp-computer-purchase-form ref="realForm" :disabled="true" normal></erp-computer-purchase-form>
          <!-- 流程历史跟踪 -->
          <common-flow-list v-if="model.bpmStatus !== '1'" :formData="formData"></common-flow-list>
        </a-col>
      </a-row>
      <!-- </biz-his-task-module> -->
      <erp-computer-purchase-modal ref="modalForm" @ok="modalFormOk"></erp-computer-purchase-modal>
      <bpm-biz-task-deal-modal
        ref="taskDealModal"
        :path="path"
        :formData="formData"
        @ok="handleOk"></bpm-biz-task-deal-modal>
      <bpm-process-track-modal ref="bpmProcessTrackModal"></bpm-process-track-modal>
      <biz-task-notify-modal ref="taskNotifyModal"></biz-task-notify-modal>
      <biz-task-notify-me-modal ref="taskNotifyMeModal"></biz-task-notify-me-modal>
    </a-card>

    <div style="text-align: center;margin-top: 15px;">
      <a-button v-print="'#printContent'" type="primary">打印</a-button>
    </div>
    <ErpComputerPurchaseFormPrint class="print_style" id="printContent" :formData="model" :formDataHistory="formData"></ErpComputerPurchaseFormPrint>
  </div>
</template>

<script>

  import { getAction, postAction } from '@/api/manage'
  import { JeecgBpmListMixin } from '@/mixins/JeecgBpmListMixin'
  import BizHisTaskModule from '@/views/modules/bpmbiz/common/BizHisTaskModule.vue';
  import BpmBizTaskDealModal from '@/views/modules/bpmbiz/common/BpmBizTaskDealModal.vue';
  import BpmProcessTrackModal from '@/views/modules/bpmbiz/common/BpmProcessTrackModal.vue';
  import BizTaskNotifyModal from '@/views/modules/bpmbiz/common/BizTaskNotifyModal.vue';
  import BizTaskNotifyMeModal from '@/views/modules/bpmbiz/common/BizTaskNotifyMeModal.vue';
  import ErpComputerPurchaseForm from './modules/ErpComputerPurchaseForm'
  import ErpComputerPurchaseModal from './modules/ErpComputerPurchaseModal'
  import ErpComputerPurchaseDetailList from './ErpComputerPurchaseDetailList.vue'
  import { DisabledAuthFilterMixin } from '@/mixins/DisabledAuthFilterMixin'
  import CommonFlowList from '@/views/components/CommonFlowList.vue' // 审批历史流程列表组件
  import ErpComputerPurchaseFormPrint from './modules/ErpComputerPurchaseFormPrint.vue'; // 打印定制

  export default {
    name: 'ErpComputerPurchaseDetail',
    mixins: [JeecgBpmListMixin, DisabledAuthFilterMixin],
    components: {
    //  ErpComputerPurchaseForm,
    //  ErpComputerPurchaseModal,
    //   ErpComputerPurchaseDetailList,
    ErpComputerPurchaseForm,
     ErpComputerPurchaseModal,
     BizHisTaskModule,
     BpmBizTaskDealModal,
     BpmProcessTrackModal,
     BizTaskNotifyModal,
     BizTaskNotifyMeModal,
    ErpComputerPurchaseDetailList,
    CommonFlowList,
    ErpComputerPurchaseFormPrint
    },
    data () {
      return {
         model: {},
        id: '',
        url: {
          queryById: '/api/erp/workbench/article/erpComputerPurchase/queryById',
          delete: '/api/erp/workbench/article/erpComputerPurchase/delete',
          submit: '/api/erp/workbench/article/erpComputerPurchase/submit',
          revoke: '/api/erp/workbench/article/erpComputerPurchase/revoke',
          counterTrial: '/api/erp/workbench/article/erpComputerPurchase/counterTrial',
          audit: '/api/erp/workbench/article/erpComputerPurchase/audit',
          overrule: '/api/erp/workbench/article/erpComputerPurchase/overrule'
        },
        confirmLoading: false,
        iconStyle: { 'font-size': '20px' },
        // 代码生成后需手动设置流程编码
        flowCode: 'onl_erp_computer_purchase',
        formUrl: 'erp/workbench/article/modules/ErpComputerPurchaseForm',
        formUrlMobile: ''
      }
    },
    created() {
    },
    watch: {
      $route(to, from) {
        this.loadData();
      }
    },
    mounted() {
    },
    methods: {
      loadData() {
        const id = this.$route.params.id;
        console.log('传到明细的id为:',id);
        getAction(this.url.queryById, { id }).then((res) => {
          if (res.success) {
            const model = res.result
            this.$refs.realForm.edit(model);
            this.model = model;
            // 查询催办
            let params1 = { flowCode: this.flowCode, dataId: id };// 查询条件
            getAction(this.url.checkNotify, params1).then((res2) => {
              if (res2.result) {
                this.model.taskUrge = true;
              }
            })
            // 查询流程
            let params = { flowCode: this.flowCode, dataId: this.model.id };// 查询条件
            this.viewTrack(params);
          }
        })
        this.bizCountById(id);
      }
    }
  }
</script>
<style lang="less" scoped>
@import '~@assets/less/common.less';

.info {
  /deep/ .ant-card-head-title{
    flex: none;
    margin-right: 20px;
  }
  /deep/ .ant-card-extra{
    flex: 1;
    float: left;
  }
}
</style>
